// Estruturas para exibicao da janela de about
#ifndef ABOUT
#define ABOUT

#include <math.h>
#include <stdio.h>
#include <GL/glut.h>

#include "miscfunc.h"
#include "general.h"
#include "messages.h"
#include "logo.h"

int janabout;
bool showabout=false, firstabout=true;


extern void hide(void);
extern void controleRedisplay(void);

void displayAbout(void)
{
	glClear (GL_COLOR_BUFFER_BIT);
	glRasterPos2f(0,0);
	glDrawPixels( 500,400, GL_RGBA, GL_UNSIGNED_BYTE, logo);
	
	glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	glColor4f(0.6,0.9,0.9,0.6);
	glBegin(GL_QUADS);
		glVertex2f(20,20);
		glVertex2f(480,20);
		glVertex2f(480,380);
		glVertex2f(20,380);
	glEnd();
	
	glColor3f(1.0,1.0,1.0);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_18, 250, 360, MSG200);
	glColor3f(1.0,1.0,1.0);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 340, MSG201);
	glColor3f(0.95,0.95,0.95);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_18, 250, 310, MSG202);
	glColor3f(0.95,0.95,0.95);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_18, 250, 290, MSG203);
	glColor3f(0.95,0.95,0.95);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_18, 250, 270, MSG204);

	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 200, MSG205);
	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 180, MSG206);
	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 160, MSG207);
	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 140, MSG208);
	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 120, MSG209);
	glColor3f(0.1,0.1,0.1);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 100, MSG210);
	glColor3f(0.0,0.0,0.0);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 80, MSG211);
	glColor3f(0.0,0.0,0.0);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250,  60, MSG212);
	glColor3f(0.0,0.0,0.0);
	outtext(CENTER,GLUT_BITMAP_HELVETICA_12, 250, 40, MSG213);
	
	glutSwapBuffers();
}


void reshapeAbout (int w, int h)
{
    glutReshapeWindow(500,400);
	glViewport (0, 0, (GLsizei) 500, (GLsizei) 400);
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity ();
	gluOrtho2D (0.0, (GLdouble) 500, 0, (GLdouble) 400);
}


void mouseAbout(int bot, int stat, int x, int y)
{
	if(showabout) 
	{
		glutSetWindow(janabout);
		glutHideWindow();
		showabout=false;
	}
}

void keyboardAbout(unsigned char key, int x, int y)
{
	if(showabout) 
	{
		glutSetWindow(janabout);
		glutHideWindow();
		showabout=false;
	}
}


void constroiAbout(void)
{
    glutInitDisplayMode (GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowSize (500, 400);
    glutInitWindowPosition (50, 50);
   
    janabout=glutCreateWindow(MSG199);
    
    glClearColor (0.0,0.0,0.0,0.0);
    glShadeModel (GL_FLAT);

    glutDisplayFunc(displayAbout); 
    glutReshapeFunc(reshapeAbout);
    glutKeyboardFunc(keyboardAbout);
    glutMouseFunc(mouseAbout);
}

#endif
